const http = require('http');

http.OutgoingMessage.prototype.success = function (data) {
  this.statusCode = 200;
  this.setHeader('Content-Type', 'application/json');
  this.end(JSON.stringify({
    status: 'success',
    data,
  }));
};

http.OutgoingMessage.prototype.error = function (data) {
  this.statusCode = 500;
  this.setHeader('Content-Type', 'application/json');
  this.end(JSON.stringify({
    status: 'error',
    data,
  }));
};